<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="node_modules/jquery/dist/jquery.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			#box{
				width: 300px;
				height: 150px;
				border: 1px solid red;
			}
			.bg{
				background-color: orangered;
			}
		</style>
	</head>
	<body>
		<div id="box">
			
		</div>
		<button type="button" id="btn">切换背景色</button>
		<button id="btn2">添加内容</button>
		<button type="button">获取内容</button>
		<script type="text/javascript">
			$("#btn").click(function  () {
				// 切换类,如果有相应的类,删除,如果没有,添加
				$("#box").toggleClass('bg')
			})
			$("button:eq(1)").click(function  () {
				// $("#box").html("<h1>h1</h1>")
				$("#box").text("<h1>h1</h1>")
			})
			$("button:eq(2)").click(function  () {
				// alert($("#box").html())
				alert($("#box").text())
			})
		</script>
	</body>
</html>
